<?php 
	$_product=Mage::registry('current_product');
	$productowner=Mage::getModel('marketplacepartner/marketplacepartner')->isCustomerProducttemp($_product['entity_id']);
	if($productowner['productid']!=""){
		$rowsocial=Mage::getModel('marketplaceprofile/marketplaceprofile')->getPartnerProfileById($productowner['userid']);
?>
<link rel="stylesheet" href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) ?>frontend/default/default/Customerpartner/css/global.css"/>
<link rel="stylesheet" href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) ?>frontend/default/default/Customerpartner/css/wk-block.css"/>
<script type="text/javascript">
	if (typeof jQuery == 'undefined'){
		document.write(unescape("%3Cscript src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
	}
</script> 
<div class="block wk-block block-viewed">
	<div class="block-title"><strong><span><?php echo $rowsocial['compname'] ?></span></strong></div>
	<div class="block-content">
		<div class="partnerdetails">	
			<ul class="partnerlinks"> 
				<li>
					<a href="<?php echo  Mage::getUrl()."marketplacepartner/store?id=".$productowner['userid'] ?> " title="<?php echo Mage::helper('marketplacepartner')->__('Visit Store') ?>" id="storeconnect"><?php echo Mage::helper('marketplacepartner')->__('View Store') ?></a>
				</li>
				<li>
					<a href="<?php echo  Mage::getUrl()."marketplacepartner/collection?id=".$productowner['userid'] ?>" title="<?php echo Mage::helper('marketplacepartner')->__('Visit Complete Collection') ?>" id="siteconnect"><?php echo Mage::helper('marketplacepartner')->__('View Collection') ?></a>
				</li>
				<li class="profile-view">
					<a href="<?php echo  Mage::getUrl()."marketplacepartner/profile?id=".$productowner['userid'] ?>" title="<?php echo Mage::helper('marketplacepartner')->__('Visit Profile') ?>" id="profileconnect"><?php echo Mage::helper('marketplacepartner')->__('View Profile') ?></a>
					<div class="wk-block-hover-div">
						<div class="arrow"></div>
						<?php echo $rowsocial['compdesi']; ?>
					</div>
				</li>
				<li class="ask-que">
					<a title="<?php echo Mage::helper('marketplacepartner')->__('Ask Que') ?>" id="askque"><?php echo Mage::helper('marketplacepartner')->__('Ask Que') ?></a>
					<div id="ask-data">
						<div class="modal-header">
							<h3><?php echo Mage::helper('marketplacepartner')->__('Ask Question to me') ?>..</h3>
							<span  class="wk-close" >x</span>
							<span  style="clear:both;" ></span>
						</div>
						<form id="ask-form" method="post" >
							<span class="label"><?php echo Mage::helper('marketplacepartner')->__('Email') ?> :</span><input type="text" name="email" class="queryemail"/>
							<span class="label"><?php echo Mage::helper('marketplacepartner')->__('Subject') ?> :</span><input type="text" name="subject" class="querysubject"/>
							<span class="label"> <?php echo Mage::helper('marketplacepartner')->__('Ask') ?> :</span><textarea  name="ask" class="queryquestion"></textarea>
							<input type="hidden" name="product-id" value="<?php echo $_product['entity_id'];?>" />
							<input type="hidden" name="seller-id" value="<?php echo $productowner['userid'];?>"/>
							<?php
							  /*require_once('recaptchalib.php');			
							  $publickey = Mage::getStoreConfig('partners/partners_options/recaptchapublic'); // you got this from the signup page
							  echo recaptcha_get_html($publickey); */
							?>
							<div class="modal-footer">
								<span class="error"></span>
								<input type="reset" value="<?php echo Mage::helper('marketplacepartner')->__('Reset') ?>" id="resetbtn"/>
								<input type="button" value="<?php echo Mage::helper('marketplacepartner')->__('Ask') ?>" id="askbtn"/>
								<span style="clear:both;"></span>
							</div>
						</form>
					</div>
				</li>
				<li>
					<a target="_blank" href="http://www.facebook.com/<?php echo $rowsocial['facebookid']; ?>" title="Link Up With Facebook" id="fbconnect"></a>
					<a target="_blank"  href="http://www.twitter.com/<?php echo $rowsocial['twitterid']; ?>" title="Link Up With Twitter"id="twconnect"></a>
				</li>
			</ul>
		</div>
	</div>	
</div>
<script>
	$wk_jq=jQuery.noConflict();
	$wk_jq(function(){
		$wk_jq('.wk-block-hover-div').prepend($wk_jq('<a />').attr('href','<?php echo $this->getUrl()."customerpartner/profile?id=".$rowdata['userid'] ?>')
							.append($wk_jq('<img />').addClass('hover-bannerpicrs').attr('src','<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'avatar/'.$rowsocial['logopic']; ?>')));
		
		$wk_jq('#ask-form').delegate('input,textarea','focus',function(){
			$wk_jq(this).removeClass('error-border');
		});
		$wk_jq('.wrapper').append($wk_jq('#ask-data'));
		$wk_jq('.ask-que').click(function(){
			$wk_jq('#ask-form input,#ask-form textarea').removeClass('error-border');
			$wk_jq('.page').css('opacity','0.4');
			$wk_jq('#ask-data').show();
		});
		$wk_jq('.wk-close').click(function(){
			$wk_jq('.page').css('opacity','1');
			$wk_jq('#resetbtn').trigger('click');
			$wk_jq('#ask-data').hide();
		});
		
		$wk_jq('#askbtn').click(function(){
			var f=0;
			$wk_jq('#ask-form input,#ask-form textarea').each(function(){
				if($wk_jq(this).val()==''){
					$wk_jq(this).addClass('error-border');
					f++;
				}
			});
			if(f>0){
				$wk_jq('#ask-form .error').text("<?php echo Mage::helper('marketplacepartner')->__('Fill all the fields') ?>").slideDown('slow').delay(2000).slideUp('slow');
			}else{	
				$wk_jq('#ask-data').addClass('mail-procss');
				$wk_jq.ajax({
					url:'<?php echo Mage::getBaseUrl();?>marketplacepartner/sendmail',
					data:$wk_jq('#ask-form').serialize(),
					type:'post',
					dataType:'json',
					success:function(d){
						$wk_jq('#ask-data').removeClass('mail-procss')
						//if(d.is_valid){
							alert("<?php echo Mage::helper('marketplacepartner')->__('Mail Send') ?>..");
							$wk_jq('.wk-close,#resetbtn').trigger('click');
						//}else{
							//alert (d.error);
							//Recaptcha.reload();
							//$wk_jq('#recaptcha_reload_btn').trigger('click');
						
					}
				});
			}	
		});
	});
</script>
<?php } ?>
